﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Control_SelUser : System.Web.UI.UserControl
{
    //private int _Eid;
    private bool _IsAllEmp = false;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            hidJid.Value = EmpName != "" ? EmployeeId : "";
            txtJob.Text = EmpName != "" ? EmpName : "";

            if (IsAllEmp)
            {
                ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=t', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
            }
            else
            {
                ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=f', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
            }
        }

    }

    public bool IsAllEmp
    {
        get
        {
            return _IsAllEmp;
        }
        set
        {
            _IsAllEmp = value;
        }
    }
    public string EmployeeId
    {
        get
        {
            return hidJid.Value;
        }
        set
        {
            hidJid.Value = value;
        }
    }

    public string EmpName
    {
        get
        {
            return txtJob.Text;
        }
        set
        {
            txtJob.Text = value;
        }
    }

    public void SelUserInti(string Eid, string Ename)
    {
        txtJob.Text = Ename;
        hidJid.Value = Eid;

        txtJob.Attributes.Add("onmouseover", "this.readOnly=true");
        txtJob.Attributes.Add("onmouseout", "this.readOnly=false");

        if (IsAllEmp)
        {
            ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=t', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
        }
        else
        {
            ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=f', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
        }
        //txtJob.Enabled = false;
    }

    public void ReadOnly(string Eid, string Ename)
    {
        txtJob.Enabled = true;

        txtJob.Text = Ename;
        hidJid.Value = Eid;

        txtJob.ReadOnly = true;
        ImageButton1.Visible = false;


        if (IsAllEmp)
        {
            ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=t', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
        }
        else
        {
            ImageButton1.Attributes.Add("onclick", "window.open ('../Common/SelEmployees.aspx?mode=f', '员工搜索', 'height=500, width=600, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
        }
    }


}
